Updating virtual memory addresses of target application functionalities for an updated version of application binary code

ABSTRACT

Systems, methods, and computer programs are disclosed for updating virtual memory addresses of target application functionalities for an updated version of application binary code. The method comprises storing a virtual address mapping table associated with application binary code registered with a high-level operating system. The virtual address mapping table comprises a plurality of virtual addresses mapped to corresponding target application functionalities in the application binary code. In response to receiving an updated version of the application binary code, a pseudo binary code template is selected, which is associated with one or more of the plurality of virtual addresses in the virtual address mapping table. The pseudo binary code template is matched to binary instructions in the updated version of the application binary code. The new virtual addresses corresponding to the matching binary instructions are determined. The virtual address mapping table is updated with the new virtual addresses.

PRIORITY CLAIM AND CROSS-REFERENCE TO RELATED APPLICATION

This patent application claims priority under 35 U.S.C. § 119(e) to U.S.Provisional Application Ser. No. 62/368,223, filed Jul. 29, 2016,entitled, “KERNEL-BASED DETECTION OF TARGET APPLICATION FUNCTIONALITYUSING VIRTUAL ADDRESS MAPPING,” the entire contents of which are herebyincorporated by reference.

DESCRIPTION OF THE RELATED ART

There are various high level applications running on a hardware platformthat does not show any noticeable activity at the system or platformlayer and hence provides no opportunities to detect useful functionaland behavioral information of the application execution.

A common example being high level Web browser application on beingcompromised with security exploits (e.g., Cross Site Scripting) duringit's execution on the device that do not leave any indicative trace atthe system and the platform level. There is no way to determine thatsuch an activity is happening on the high level application by probingeither the system libraries, the platform, the SOC hardware, or watchingthe device level activities.

Hence to have better platform level control on various third partyapplications running on the device and to detect some of the functionaland behavioral activities of these executing high level applications,there is a need to develop a mechanism that enables expressing andcommunicating the high level application functionalities and behaviorinto a form that the platform's HLOS or kernel can understand. This willallow the platform to have better understanding on the executingapplication's behavior and allow the platform to take decisions andactions to handle various different situations of the executingapplications.

As an example a platform level decision to prevent a Web Securityexploit on a third party web browser application can be taken using theinformation. Other areas of example uses are the platform takingdecisions like increasing/decreasing the frequencies of various SOCcomponents (DDR, Bus, CPU, Caches) or engage high or low power modesonce a specific functional or behavioral nature of the application isdetected using the mechanisms in this disclosure at the HLOS or kernellayer. In general with this disclosure the platform gets the opportunityto do various controls on the various third party applications executingon the device by detecting and recognizing the functionality beingexecuted by the application. This allows SOC and platform vendors toprovide a better solution from the platform level for various thirdparty applications on which the platform otherwise have no control over.

SUMMARY OF THE DISCLOSURE

Systems, methods, and computer programs are disclosed for updatingvirtual memory addresses of target application functionalities for anupdated version of application binary code. The method comprises storinga virtual address mapping table associated with application binary coderegistered with a high-level operating system. The virtual addressmapping table comprises a plurality of virtual addresses mapped tocorresponding target application functionalities in the applicationbinary code. In response to receiving an updated version of theapplication binary code, a pseudo binary code template is selected,which is associated with one or more of the plurality of virtualaddresses in the virtual address mapping table. The pseudo binary codetemplate is matched to binary instructions in the updated version of theapplication binary code. The new virtual addresses corresponding to thematching binary instructions are determined. The virtual address mappingtable is updated with the new virtual addresses.

A system comprises a processing device configured to execute applicationbinary code, a high-level operating system (HLOS) comprising a virtualaddress mapping table, and a controller. The virtual address mappingtable is associated with the application binary code and comprises aplurality of virtual addresses mapped to corresponding targetapplication functionalities in the application binary code. Thecontroller updates the virtual address mapping table in response toreceiving an updated version of the application binary code. Thecontroller comprises logic configured to: select a pseudo binary codetemplate associated with one or more of the plurality of virtualaddresses in the virtual address mapping table; match the pseudo binarycode template to binary instructions in the updated version of theapplication binary code; determine the new virtual addressescorresponding to the matching binary instructions; and update thevirtual address mapping table with the new virtual addresses.

BRIEF DESCRIPTION OF THE DRAWINGS

In the Figures, like reference numerals refer to like parts throughoutthe various views unless otherwise indicated. For reference numeralswith letter character designations such as “102A” or “102B”, the lettercharacter designations may differentiate two like parts or elementspresent in the same Figure. Letter character designations for referencenumerals may be omitted when it is intended that a reference numeral toencompass all parts having the same reference numeral in all Figures.

FIG. 1 is a block diagram of an embodiment of a system for detectingtarget application functionality using virtual address mapping in asecure memory.

FIG. 2 illustrates an exemplary mapping of target applicationfunctionality to the corresponding application binary code.

FIG. 3 illustrates an exemplary embodiment of a virtualaddress-to-function mapping table (VAFMT).

FIG. 4 is a flowchart illustrating an embodiment of a method fordetecting malicious code activity in the system of FIG. 1.

FIG. 5 illustrates another embodiment of a VAFMT used for dynamicallyidentifying boundaries of a virtual machine code space.

FIG. 6 illustrates an embodiment of an identifier-to-virtual mappingtable (IVAMT) used in combination with a VAFMT.

FIG. 7 shows a portion of a VM code space used in connection with agarbage collection process.

FIG. 8 shows exemplary points of interest for a garbage collectionfunction in the virtual machine of FIG. 1 and the virtual addresses forthe functional points of interest in the VAFMT that are used to detectthe execution of the garbage collection activity during the execution ofthe application binary containing the virtual machine.

FIG. 9 illustrates an exemplary mapping of virtual addresses forexternal/internal boundaries for a virtual machine heap.

FIG. 10 is a flowchart illustrating an embodiment of a method fordetecting malicious code activity in the system of FIG. 1 in a virtualmachine embodiment.

FIG. 11 illustrates an embodiment of a VAFMT comprising virtualaddresses for specific buffer allocator functions that are used todetermine the virtual addresses of dynamically allocated bufferscontaining objects of specific data structure types and values ofmembers/fields of the objects allocated in the buffer.

FIG. 12 is a combined block/flow diagram illustrating an embodiment ofsystem for automatically updating the VAFMT in response to receiving anupdated version of the application binary code.

FIG. 13 illustrates the VAFMT of FIG. 12 with updated virtual addressesand metadata.

FIG. 14 illustrates an exemplary matching of functional points ofinterest in the VAFMT of FIG. 12 to a pseudo binary code template.

FIG. 15 illustrates an exemplary matching of the pseudo binary codetemplate of FIG. 14 to a matched region in the updated version of theapplication binary code.

FIG. 16 is a flowchart illustrating an embodiment of a method forupdating the VAFMT in response to receiving an updated version of theapplication binary code.

DETAILED DESCRIPTION

The word “exemplary” is used herein to mean “serving as an example,instance, or illustration.” Any aspect described herein as “exemplary”is not necessarily to be construed as preferred or advantageous overother aspects.

In this description, the term “application” may also include fileshaving executable content, such as: object code, scripts, byte code,markup language files, and patches. In addition, an “application”referred to herein, may also include files that are not executable innature, such as documents that may need to be opened or other data filesthat need to be accessed.

The term “content” may also include files having executable content,such as: object code, scripts, byte code, markup language files, andpatches. In addition, “content” referred to herein, may also includefiles that are not executable in nature, such as documents that may needto be opened or other data files that need to be accessed.

As used in this description, the terms “component,” “database,”“module,” “system,” and the like are intended to refer to acomputer-related entity, either hardware, firmware, a combination ofhardware and software, software, or software in execution. For example,a component may be, but is not limited to being, a process running on aprocessor, a processor, an object, an executable, a thread of execution,a program, and/or a computer. By way of illustration, both anapplication running on a computing device and the computing device maybe a component. One or more components may reside within a processand/or thread of execution, and a component may be localized on onecomputer and/or distributed between two or more computers. In addition,these components may execute from various computer readable media havingvarious data structures stored thereon. The components may communicateby way of local and/or remote processes such as in accordance with asignal having one or more data packets (e.g., data from one componentinteracting with another component in a local system, distributedsystem, and/or across a network such as the Internet with other systemsby way of the signal).

FIG. 1 illustrates an embodiment of a system 100 for detecting desiredor target high-level functionalities of an application binary from akernel or operating system (O/S) layer. As illustrated in the embodimentof FIG. 1, the system 100 comprises a processing device (e.g., a centralprocessing unit (CPU) 102), a memory 104, and a high-level operatingsystem (HLOS) 106. The memory 104 stores one or more applications thatmay be executed by the CPU 102. The memory 104 may store the applicationbinary code 108 corresponding to reference application source code 110associated with the application(s) installed on a computing device. Inthis regard, the system 100 may be implemented in any desirablecomputing device or system, including, for example, a personal computer,a laptop computer, a workstation, a server, or a portable computingdevice (PCD), such as a cellular telephone, a smart phone, a portabledigital assistant (PDA), a portable game console, a navigation device, atablet computer, a wearable device (e.g., smart watch), or otherbattery-powered portable device.

In an embodiment, the kernel or O/S layer comprises a high-leveloperating system (HLOS) 106. As illustrated in FIG. 1, the HLOS 106comprises a list of registered applications 112, a secure memory (e.g.,a trusted zone 114), and specially configured virtual address mappingtable(s) for the application binary code 108 of each registeredapplication. The list of registered applications 112 identifiesapplications installed on the system 100 that have been registered withthe HLOS 106 for secure control and/or support. For example, theapplication binary code 108 of an application (e.g., a web application,a browser application, etc.) may be registered with the HLOS 106 andidentified in the list 112. As known in the art, the trusted zone 114comprises a secure memory or area configured to guarantee that codeand/or data loaded into memory and/or executed is protected with respectto security, confidentiality, integrity, etc. The application binarycode 108 for the registered application(s) may have one or more virtualaddress mapping table(s), which are used by the HLOS 106 and/or thealgorithms in the trusted zone 114 to identify desired or targethigh-level application functionalities by tracking the execution ofpredetermined virtual address points.

It should be appreciated that the system 100 may be applied to variousapplication domains in which tracking and detecting high-levelapplication functionalities at the kernel layer is advantageous. Forexample, in one exemplary embodiment, the kernel may control decisions,such as, increasing and/or decreasing the frequency of various system onchip (SoC) components (e.g., a central processing unit (CPU), cache(s),double data rate (DDR) memory, one or more buses, etc.) or set highand/or low power modes and enable/disable specific hardware features inresponse to the detection of specific functional or behavioral nature ofexecuting applications. In this manner, the HLOS 106 and the kernel hasthe opportunity to implement various controls on the various third partyapplications executing on the device by detecting and recognizing thefunctionality being executed by the application. It should beappreciated that this may allow the SoC and platform vendors to provideimproved solutions from the platform/HLOS/kernel level for various thirdparty applications on which the platform otherwise may have no control.

In an exemplary application domain, the system 100 may provide real-timesecurity protection against malicious attacks or other exploits of webapplications, web browsers, JavaScript code, etc. As known in the art,JavaScript is the programming language used in many websites and webapplications, JavaScript-based attacks are one of the top threats forcyber security. As more and more web activity shifts from desktopcomputers to mobile, JavaScript attacks are becoming a major threat onportable computing devices.

Most malicious JavaScript attacks utilize the characteristics of theJavaScript language and the constraints of web standards andspecifications for the exploits. Common examples of web-based exploitsthrough malicious JavaScript include the following: cross-site scripting(i.e., XSS/CSS), cross-site request forgery (i.e., CSRF/XSRF), drive-bydownloads, user intent hijacking, clickjacking, distributed Denial ofService (DDoS), JavaScript steganography, and various forms ofobfuscated JavaScript. Because high-level web behavior and functionalityknowledge is needed in the attempt to detect malicious behaviors,current web and JavaScript security solutions are typically built withinthe browser software architecture.

In-built web security mechanisms within the HLOS, kernel and the deviceplatform, however, are limited because web/JavaScript-based exploits mayhave no visible indication on the platform activity (e.g., system calls,device usage, etc.). Many web/JavaScript-based attacks areoutward-facing and only compromise the user's online assets, activity,identity, etc. In other words, the visible activity patterns may only bedetected within the web browser/application software and hence mostsecurity mechanisms against web exploits are almost always built withinthe web browser application.

In this regard, exemplary embodiments of the application binary code 108in system 100 may comprise web applications, browser applications, orother applications in which the HLOS 106 detects high-level applicationfunctionalities by tracking predetermined virtual address points. Asfurther illustrated in FIG. 1, the system 100 may further comprise oneor more malicious code detection algorithms 116 residing in the trustedzone 114. The malicious code detection algorithms 116 may receive datarelated to execution of the virtual address points and their associatedfunctional meanings as identified in the virtual address mapping tables.Based on this data, the algorithm(s) 116 may detect, for example,malicious code and behavior, malicious JavaScript code and execution,etc. and initiate appropriate methods for resolving the security threator otherwise thwarting the malicious attack. In an embodiment, when asecurity threat is detected, the system 100 may automatically resolvethe threat or prompt a user for appropriate action(s).

As illustrated in the embodiment of FIG. 1, the virtual address mappingtables used by the HLOS 106 may comprise a virtual address-to-functionmapping table 120 and an identifier-to-virtual address mapping table122. It should be appreciated that the HLOS 106 and the mapping tables120 and 122 comprise an integrated platform mechanism by which thesystem 100 may determine desired or target high-level functionalinformation from the executing application binary code 108. Thehigh-level functional information may be used by algorithm(s) and/ormodel(s) (e.g., malicious code detection algorithm(s) 116) implementedin the trusted zone 114 to detect malicious behavior.

As described below in more detail, the system 100 may support twodifferent execution models for executing the application binary code108. A first execution model involves native binary execution (e.g.,from C/C++ code). A second execution model involves managed runtimeexecution (e.g., execution by a virtual machine 118). In an embodiment,the virtual machine 118 may execute dynamic just-in-time (JIT) orinterpreted code from JavaScript sources. In managed runtime executionembodiment, the virtual machine 118 may comprise part of the binary code108 in which the virtual machine 118 runs within the binary code 108. Itshould be appreciated, however, that in other embodiments there may beseparate VM and binary workloads.

An exemplary embodiment of the native binary execution model isillustrated in FIGS. 2-4. For native binary execution, each applicationin the list of registered applications 112 has a corresponding VAFMT120, which is maintained by the HLOS 106. The VAFMT 120 may reside inthe trusted zone 114. The VAFMT 120 comprises different virtualaddresses of interest mapped with their associated high-levelfunctionality. In an embodiment, each associated high-levelfunctionality may be denoted as a macro name that the algorithm(s) 116understand. It should be appreciated, however, that other mechanisms forrepresenting the associated high-level functionality may be implemented,including, for example, pointers to functions or function names in thealgorithms 116 such that the activity detected at a particular virtualaddress directly corresponds to a functionality that needs to betriggered in the algorithm(s) 116. The virtual addresses of the specificapplication functions (and specific points within functions) in a binaryimage may be referred to as “points of interest”. In an embodiment,virtual address points of interest may comprise points within, at thestart, or at the end of, or multiple specific points in between, forexample, sensitive sources/sinks routines, dangerous web applicationprogram interfaces (APIs), specific web functionality, start/end ofbuffers, or any other objects that an attacker may exploit or othersuitable information for the analysis and detection of knownweb/JavaScript attacks. In other embodiments, the virtual address pointsof interest may comprise points in the implementation of a JavaScriptinterpreter, just-in-time (JIT) compiler, or a runtime environment(e.g., allocation/deallocation functions for a virtual machine heap thatstores JavaScript source code, bytecode/JITcode, etc.

FIGS. 2 and 3 illustrate an exemplary embodiment of a VAFMT 120. FIG. 2illustrates a logical mapping 200 of certain desired or targetfunctionality points within the application source code 110 to thecorresponding virtual address points within the application binary code108. In FIGS. 2 & 3, the virtual addresses are shown but the binaryobject code is not shown. In this embodiment, the application sourcecode 110 comprises C++ code for a “documentWrite” function. The point201 in the source code is mapped to a virtual address 202 in the binarycode. The point 203 in the source code is mapped to the virtual address204 in the binary code. The point 205 of the source code is mapped tothe virtual address 206 in the binary code. FIG. 3 illustrates a logicalmapping 300 of the virtual addresses in the binary code 202, 204, and206 that are under the column 302 in the VAFMT 120 to the respectivefunctional meanings that the code at those virtual addresses represent.As illustrated in FIG. 3, the VAFMT 120 may comprise a plurality ofvirtual addresses (column 302) with a corresponding description of thefunctional point of interest (column 304). The virtual address(0x3273fac8) represented by 202 for the binary code point is mapped to afunctional point corresponding to the DOCUMENT_WRITE_FUNCTION_START. Thevirtual address (0x3473fad4) represented by 204 for the binary codepoint corresponding to the functional point of interest that denotesDOCUMENT_WRITE_1. The virtual address (0x3473fae8) represented by 206 inthe binary code is mapped to a for the functional point that has a macromeaning DOCUMENT_WRITE_2.

FIG. 11 illustrates an embodiment of a VAFMT 120 comprising a customvirtual address table that has virtual addresses for specific bufferallocator functions that may be used to determine virtual addresses ofthe start and the end of the dynamically allocated buffers comprisingobjects of specific data structure types (e.g., class, structure,union). The values of the members/fields of the objects allocated in thebuffer may be determined using the offset and the length fields, whichmay also be maintained in the table for a particular field/member thatis a point of interest. The virtual addresses of the buffer allocationfunctions may be used to detect the size and the addresses of theallocated buffer by, for example, tracking the execution of the systemmemory allocator functions from the region covered by the virtualaddresses of the allocator functions. Once the buffer start and endvirtual addresses are known, the offset and the length fields may beused to determine the value of a particular member/field of the objectsfor the particular data structure type.

As illustrated by the dashed lines in FIG. 1, the application sourcecode 110 need not be stored in the system 100. Rather, it may be locatedoff-line or off-device and available as reference or open source code.The reference source code for a particular version can be used asreference and guidance to determine the virtual addresses of interest inthe actual commercial binary of the browser or the web applications. Anequivalent binary may be compiled from the open source project'smatching code revision/version. The compiled binary may be used as areference to detect the desired or target virtual addresses andfunctions/points of the application binary that is based on thatversion/revision. Similar compiler and linker options may be used.Furthermore, breakpoints at various points in the application code canbe used for the determination of the virtual addresses and theirfunctional mapping points. Binary code recognition and similarityextraction methods may be utilized to identify the functionalities inthe given application binary by using the reference binary from theknown compiled functions for the open source project. For binaries withslightly modified versions (or binaries originating from a source basewith some source code differences from the known reference open sourceprojects), test codes may be written that invoke the important webfunctions and APIs. The virtual address access sequences from varioustest cases may be used to converge to a set of target virtual addresspoints. It should be appreciated that other mechanisms may be used toextract functionality from the application binary code.

FIG. 4 is a flowchart illustrating an embodiment of a method 400 fordetecting malicious code activity in a native binary execution model. Atblock 402, a VAFMT 120 is generated for an application. As describedabove, the VAFMT 120 comprises a plurality of virtual addresses ofinterest mapped to corresponding high-level application functionality.At block 404, the application may be installed on a computing device,such as, for example, a portable computing device. At block 406, theapplication may be registered for security support provided by the HLOS106 (e.g., registered applications 112). At block 408, the applicationmay be launched and, in response, the CPU 102 may execute theapplication binary code 108. When a registered application 112 runs, theHLOS 106 may intercept the application's running processes (block 410).At block 412, the HLOS 106 may use the corresponding VAFMT 120 to detectand record the functional points of interest as they are executed. Atblock 414, the recorded points may be provided to the malicious codedetection algorithm(s) 116 to detect and resolve malicious attacks. Themalicious code detection algorithm(s) 116 may comprise signature-basedalgorithm(s), pattern matching algorithms, or employ machine learning,or other techniques. In this manner, the malicious code detectionalgorithm(s) 116 may use the VAFMT 120 to provide the meaning of thevirtual addresses it receives as input.

Because the VAFMT 120 is under the control of the HLOS 106, anytransformation/randomization of the virtual addresses of the applicationbinary code 108 performed by the HLOS 106 (e.g., address space layoutrandomization (ASLR)) may be applied to the virtual addresses in VAFMT120 to keep them in synchronization with the effective virtual addressof the executing application. In an embodiment, the information gatheredfrom the JavaScript code and the application execution with the VAFMT120 may provide the high-level web/JavaScript functionality information,which can be fed to the malicious code detection algorithms 116. Upondetecting any malicious behavior (block 416), the HLOS 106 may pause theapplication/renderer/JavaScript process and open a dialog box for theuser, warning about the potential danger, and asking the user forinstructions for proceeding. If the user still wants to proceed, thebrowser process may be resumed by the HLOS 106. If the user does notwant to proceed, the HLOS 106 may ask the user to close the tab ornavigate to some other website, or the HLOS 106 may end the process forthat execution instance (browser tab).

The VAFMT 120 may be updated via, for example, over-the-air (OTA)updates when the application binary code 110 version changes. Theseupdates ensure the HLOS 106 is ready with updated binaries for anyregistered applications 112. The updated binaries may yield new virtualaddresses for the same points of interest.

It should be appreciated that the HLOS 106 and the mapping tables 120and 122 may also be configured to support a managed runtime executionmodel involving, for example, a virtual machine 118 (FIG. 1). In thisregard, the integrated platform mechanism(s) described above enable thesystem 100 to determine desired or target high-level functionalinformation from the executing application binary code 108. An exemplaryembodiment of the managed runtime execution model is illustrated inFIGS. 5-10.

In embodiments involving managed runtime or virtual machine execution,JavaScript sources and/or bytecode/just-in-time (JIT) binary for theJavaScript sources may be read from different parts of a virtual machine(VM) heap with the aid of another table (e.g., the identifier-to-addressmapping table (IVAMT) 122). The IVAMT 122 comprises virtual memoryaddresses for important boundaries of the VM heap. It may furthercomprise other types of entries where virtual addresses for variousfunctional points of the virtual machine 118 or the application binary108 could be maintained. It should be appreciated that the IVAMT 122 maybe generally used for virtual addresses for specific functional pointsthat may be updated and/or determined dynamically during applicationexecution. In this regard, the IVAMT 122 may map a functional point tothe virtual address. The VAFMT 120, on the other hand, may map astatically defined virtual address to a functional meaning. Therefore,the VAFMT 120 may not change during application execution but may beupdated by, for example, other-the-air (OTA) updates to a computingdevice. It should be further appreciated that other miscellaneous tablesmay be associated with the VAFMT 120 and the IVAMT 122. Themiscellaneous tables may comprise various macro or parameter namesmapped to their parameter values or settings that are not virtualaddresses.

In the embodiment of FIG. 9, virtual memory addresses 901 are identifiedfor various external and/or internal boundaries of an exemplary VM heapstructure 900. As illustrated in FIG. 9, the VM heap structure 900 maycomprise a plurality of data fields identifying various internal and/orexternal boundaries, including, for example, a from field 912, a tofield 914, a code field 902, a map field 904, a large object field 906,an old data field 908, and old pointer fields 910. The VM heap is a VMmanaged memory region that is allocated in the native system heap. Asknown in the art, in the VM Heap, the VM performs abstraction of, forexample, memory management, allocating and deallocating the code (e.g.,JavaScript source), the bytecode, intermediate code, JITed binary, theobjects created during execution, and all other associated housekeepinginformation and internal data structures used for the execution of theprogram (e.g., JavaScript program). As further illustrated in FIG. 9,the VM heap region may comprise various sub-regions (e.g., 910, 908,906, 904, 902, 912, and 914) depending on the type of things the VMstores. Sub-regions 912 and 914 may be used to contain the objectscreated for the first time and any garbage collection activity swaps thelive objects from sub-regions 912 to 914 and vice versa. In anembodiment, sub-region 902 may be used to save JavaScript source,bytecodes, intermediate codes, and JITed binary/assembly codes.Sub-region 904 may be used to keep certain internal data structuresassociated with the objects created by the VM during execution of aprogram (e.g., JavaScript program). Sub-region 906 may be used to keepany kind of item (code, object) that is bigger than a predetermined size(e.g., 1 MB). Sub-regions 908 and 910 may keep objects and data thathave survived multiple cycles of garbage collection with sub-region 908focusing objects with constant values and sub-region 910 focusing onobjects that points to other objects.

In operation, the HLOS 106 may identify and dynamically update thevirtual memory addresses 901 in the IVAMT 122 as memory allocationschange for the VM heap. It should be appreciated that a JavaScriptvirtual machine 118 keeps the sources in the heap until the function isactive. The managed runtime or virtual machine execution model mayinvolve identifying JavaScript sources and/or bytecode/JIT code from theVM heap. The VM heap objects holding JavaScript sources may be trackedfor any new writes, and new JavaScript sources received by the virtualmachine 118 may be identified. The identified JavaScript sources may beprovided to the algorithm(s) 116 in the trusted zone 114, which extractsvarious features from the JavaScript code and uses them for detectingany malicious behavior. Examples of features extracted from theJavaScript code include the following or other features: document objectmodel (DOM) modification and sensitive functions; a number ofevaluations; a number of strings; a script length; string modificationfunction(s); “built-ins”for de-obfuscation, etc.). The trusted zone 115may feed the extracted features to the malicious code detectionalgorithms 116 to determine any malicious activity.

In certain embodiments, when only JIT binary/bytecodes are available,the features may be extracted from them and then sent to the maliciouscode detection algorithms 116. For example, the HLOS 106 may maintain alibrary of bytecode/JIT code sequences representing high-levelJavaScript artifacts. Any matches of the bytecode/JIT code stream fromthe JavaScript functions in the VM code space with these artifacts maybe recorded and passed to the malicious code detection algorithms 116for the determination of malicious characteristics.

FIGS. 5 & 6 illustrate an exemplary embodiment of the IVAMT 122 and theVAFMT 120 used during managed runtime or virtual machine execution. FIG.5 illustrates a logical mapping 500 of target functionality related toallocation of a VM code space to corresponding application binary code108. In this embodiment, the application source code 110 comprises codefor a “AllocateVMCodeSpace” function. As illustrated in FIG. 5, a firstpoint in the source code 110 may be mapped to a virtual addresses 502 inthe binary code 108. A second point in the source code 110 may be mappedto a virtual address 504 in the binary code 108. In an exampleimplementation, the function AllocateVMCodeSpace may be called when theVM during execution gets a new JavaScript source code that it needs toexecute and it is determined that there is not much space in the currentVM heap code space (902). This function may take the size of the newJavaScript code and determine the amount by which the VM heap code spaceneeds to be increased in size so that the VM can save the JavaScriptsource, the associated bytecode or intermediate code and/or the JITedbinary. Based on the determined size, the AllocateVMCodeSpace functionmay increase the allocated space of the VM heap code space in the nativeplatform's heap using the system allocator functions, such a, mmap( ),malloc( ), calloc( ), or realloc( ). The mmap( ) function is a POSIXcompliant Unix system call that maps a sequence of bytes starting at anoffset from the other object specified by the file descriptor intomemory, preferably at address start. The mmap( ) function returns theactual place where the object is mapped. Malloc( ), realloc( ), calloc() and free( ) comprise a group of functions in the C standard libraryfor performing manual memory management for dynamic memory allocation inthe C/C++ programming language. The virtual addresses 502 and 504 forthe points of interest in the binary code 108 may be directly placed inthe column 302 in the VAFMT 120. The functional meanings of thedifferent points of interests represented by the virtual addresses maybe listed as macro names in the column 304 of VAFMT 120. The detectionalgorithm(s) 116 (FIG. 1) may have a clear understanding of thefunctionality represented by the macros in column 304 of VAFMT 120. Themacro name (in column 304) for a particular row in VAFMT 120 maydistinctly identify the functionality that is being executed when theprocessor (e.g., CPU 102) executes the application's binary instructionat that virtual address point (in column 302). In this manner, byknowing the execution statistics, counts and profile of the virtualaddresses for the points of interests, the detection algorithm(s) 116fully understand the functionality being executed by the high levelapplication binary. It should be appreciated that the mapping may bedirectly between the virtual address 302 and the functional meaning thatis represented by the macro (304) and understood by the detectionalgorithm(s) 116 that performs the processing or detection, therebyeliminating a need to know the actual binary instruction at that virtualaddress point of interest.

The points of interest represented with virtual addresses and the macromeanings may determined offline and then populated in the VAFMT 120 fora particular application binary. Many types of applications may haveavailable matching reference source code. For example, matchingreference source code may be available for commonly availableapplications developed from popular open source projects (e.g.,blink/Chromium based browsers, Webkit based browsers, various virtualmachines in Android platforms, such as, Dalvik, ART, RenderScript). Forapplications with available matching reference source code, variousoffline mechanisms may be used to determine the virtual address for thepoints of interest in the commercial application binary for acorresponding expression/statement in the source code for those pointsof interest.

An exemplary embodiment for offline determination of the virtualaddresses for the points of interest will be described. Certainimportant and useful functions in the source code 110 that implement thefunctionalities of interests may be identified in the matching referencesource code. Various points within the source code 110 may be manuallydetermined to form a unique set of points that together would representa particular unique functionality. It should be appreciated that thismay be equivalent to a set of sample points within the source code 110that uniquely represent the overall functionality of the complete sourcecode 110 for the functionality. The source code 110 may be compiled,assembled, and linked to a reference application that is equivalent tothe actual commercial third party application. Both the binaries(reference and commercial third party) may originate from the samesource code 110 and use similar build techniques (e.g., compile,assemble, link) and toolchains. As known in the art, open sourceapplications may use freely available GCC or LLVM toolchains. Thecompiler, assembler, and linker tools may be used to generate areference binary application and the virtual address pointscorresponding to the important points in the source code may be noted.Because the virtual addresses for the points of interest may comprise adirect mapping of the points of interest in the source code 110 fromwhich the binary application is built (compiled, assembled, linked), thereference binary may be used offline to compare with the commercialbinary to identify the virtual address points of interest in thecommercial third party binary. It should be further appreciated thatother offline or other techniques may be used to determine the virtualaddress for the points of interest in the commercial third party binary.In an embodiment, FIG. 2 shows how different points of interest (201,203, 205) in the source code 110 may be directly mapped to thecorresponding virtual addresses (202, 204, 206) in the binary 108.

FIG. 6 illustrates a logical mapping 600 between the VAFMT 120 of FIG. 5and an exemplary IVAMT 122. The VAFMT 120 comprises virtual addresses offixed and known points of interest in the binary application whoseexecution are of interest and are being tracked. These virtual addressesmay be updated whenever the binary application changes. The IVAMT 122comprises virtual addresses of specific points that are created orupdated when the binary application executes, which may be dynamic andrepresent virtual addresses of dynamic items (e.g., runtime buffer startor end points). The left hand column (302) of VAFMT 120 comprise thevirtual addresses, and the right hand column (304) may indicate thefunctional description that is present in the binary code 108 at thatvirtual address point. In this manner, the VAMFT 120 maps virtualaddress to functional meanings. In general, the IVAMT 122 comprises thereverse. In this case, the functional meaning or macro names are known,and the system determine the virtual address 602 where the functionalmeaning or the macro name 604 are implemented or available in theexecution instance of the binary application. The virtual addresses inthe IVAMT 122 may comprise dynamic values that are determined atruntime. For the case where the start and the end of a dynamicallyallocated buffer (or the virtual machine heap or its sub spaces) aredetermined, the virtual addresses for the points of interest within thefunctions in the binary application that are doing the dynamicbuffer/heap-space allocation may be obtained from the VAFMT 120. Theexecution of these functions may be determined by detecting theexecution of the virtual addresses in the VAMFT 120. Furthermore, thestart/end virtual addresses of the buffer/heap-space allocation may bedetermined by detecting the system memory allocation functions invokedfrom these functions. These determined start/end virtual addresses ofthe buffer/heap-space allocations may be updated in the IVAMT (122).

FIG. 7 shows the impact of garbage collection on the VM heap code spaceand how the JavaScript sources may be determined consistently in thepresence of garbage collection activity of the virtual machine 118. Itshould be appreciated that garbage collection is an integral activity ofa managed runtime or virtual machine because allocation of new objectsand deallocation of dead (i.e., not in use) objects may be explicitlyhandled by the runtime or virtual machine 118. The activity ofreclaiming dead (unused) objects from the managed VM heap is referred toas garbage collection. In this regard, when unneeded Script objects orother objects are reclaimed, the VM heap may be reorganized and existingobjects moved around and compacted to make space for new objectallocations. FIG. 7 shows the effect of such a garbage collectionactivity on VM heap code Space 704 a. VM heap code space 704 a comprisesJavaScript Objects JS1, JS2, JS3, JS4. After a garbage collection event,they may be compacted with the removal of a JavaScript Object JS3 thatwas detected as unneeded or dead by the garbage collector and,therefore, reclaimed (deleted) from the VM heap code space 704 b.However, any such movement (e.g., removal, compaction, etc.) of objectsin the VM heap changes the virtual addresses start and end locationsthat determine where the JavaScript object resides. In an exemplarymethod, the virtual addresses may be changed by re-running the virtualaddress determination mechanism illustrated in FIGS. 5 & 6 for the VMheap and the various spaces within the heap (FIG. 9) after every garbagecollection activity, thereby updating the virtual addresses with the newvalues if the Script Object moved during garbage collection. Asillustrated in FIG. 8, the kernel may keep track of the object moveshappening during garbage collection and the distance by which they move.By keeping track of the address offset the objects moved, the virtualaddress values for the start and the end of the JavaScript object in theVM heap code space may be updated. In a similar manner, the virtualaddress in IVAMT 122 for the VM heap's various code spaces may beupdated by tracking the allocations/deallocations/moves of the varioussub-spaces of the VM heap illustrated in FIG. 9.

FIG. 10 is a flowchart illustrating an embodiment of a method 1000 fordetecting malicious code activity in a managed runtime or virtualmachine execution model. It should be appreciated that the steps orfunctionality represented in blocks 1002, 1004, 1006, 1008, and 1010 inFIG. 10 may generally correspond to blocks 402, 404, 406, 408, and 410described above in connection with the method of FIG. 4. At block 1012,the method 1000 detects the points of interest virtual addresses for theVM heap allocator/deallocator functions when executed. As illustrated atblock 1014, when the execution is detected to be inside a VM heapallocator/deallocator function, the method 1000 may detect the entry VMinto the kernel's system allocator/deallocator function and record thesystem memory allocation/deallocation. Based on that, the method 1000may compute and determine the start/end virtual addresses of the VM'sheap. By implementing similar mechanism(s) for a specific allocationregion for the VM heap (e.g., code space, large object space, etc.), thestart/end virtual addresses for the specific sub-regions (e.g., codespace, large object space, etc.) within the VM heap may be determined. Aillustrated at block 1016, once the VM heap space used to store theJavaScript Source Code objects are determined at block 1014, the method1000 may use a Script Object Header signature/pattern (in binary) todetermine the start of the JavaScript Object within the VM heap. Thelength of the JavaScript Object may be extracted from the header andused to extract the entire JavaScript Source code. As illustrated atblock 1018, the JavaScript source code may be used to extract specificfeatures of interest used by the detection algorithm(s) 116 to detect,for example, malicious behavior. At block 1020, the malicious behaviorof the JavaScript code may be determined based on, for example, thefeatures extracted from the JavaScript source in block 1018.

As mentioned above, the VAFMT 120 may be initially configured in anoff-line manner and provided to the computing system 100 (FIG. 1). In anembodiment, when a new version of the application binary code 108 ismade available to the computing system 100, the VAFMT 120 may besimilarly updated in an off-line manner and provided to the computingsystem 100 via, for example, a communication network (referred to as an“over-the-air (OTA) update”). Updating the VAFMT 120 in this manner maybe a disadvantage for binary applications that are frequently updated.It should be appreciated that a relatively large portion of the binarycode in the updated version of the application binary code 108 mayremain unchanged. The functional points of interest 304 identified inthe VAFMT 120 may comprise a relatively limited portion of theapplication binary code 108 and/or binary code that may be unchangedfrom version-to-version.

For example, compiler operations and/or settings may infrequently changeand the various modules in the binary code may maintain similar orpredetermined offsets among the modules. FIGS. 12-16 illustrates variousmechanisms that may be implemented in the computing system 100 forautomatically updating the virtual addresses in the VAFMT 120 when a newor updated version of the application binary code 108 is installed.

It should be appreciated that these mechanisms may reduce the need forOTA updates of the VAFMT 120 for various types of applications and/oruse cases. For example, in the context of web security applications,these mechanisms may eliminate the need for OTA updates for many of themost frequent types of updates to web browser applications that arebased on the same originating codebase. Existing web browserapplications may update binary application code on a weekly or monthlybasis. Virtual addresses for the new binary version may change even whenthe source code has not changed for the specific modules related to thefunctional points of interest 304. In this case, the virtual addressesmay change where there are source code changes in parts of theapplication other than the functional points of interest 304, or changesin variable types and data structure types (e.g., C++ classes,C-structures, unions, etc) accessed in other parts of the application.Furthermore, certain kinds of changes in compiler, assembler, and linkeroptions may result in virtual changes in other parts of the application.

FIG. 12 illustrates an embodiment of exemplary mechanisms that may beimplemented in the computing system 100 for automatically updating theVAFMT 120 when a new or updated version of the application binary code108 is installed. As illustrated in FIG. 12, the VAFMT 120 may besupplemented with metadata 1200 and one or more pseudo binary codetemplates 1202. As described below in more detail, the metadata 1200 andthe pseudo binary code templates 1202 may enable the HLOS 106 todetermine new virtual addresses 302 for the functional points ofinterest 304 when the application binary code 108 is updated with a newversion.

It should be appreciated that the pseudo binary code template 1202comprises a sequence of operation statements using symbolicrepresentation for storage locations in memory and pseudo-registers forlocal variables. The pseudo binary code template 1202 may use variouscategories of pseudo registers that indicate their purpose. In anembodiment, an ArgumentReg# may denote pseudo registers that passarguments to subroutines. A ReturnReg may comprise the return addresswhen returning back from a subroutine call. A ProgCounter may comprisethe current address pointed by the program counter of the processor. AReturnValueReg# may denote the registers used to return values fromsubroutine calls back to the caller code. The operations may compriseclose representations of the assembly operations in the processor withinputs and outs that can be variables or storage locations. For example,an AddWord variable may indicate an addition operation of operands ofsizes 4-bytes or 1-word. A LoadWord variable may indicate loading avalue from memory that is of a predetermined size (e.g., 4 bytes or 1word). A LoadByte variable may indicate loading a value from memory thatis of a predetermined size (e.g., 1 byte). A branchEQ may comprise aconditional branch that branches to the target provided as an operand ifthe previous comparison operation results in the equality of theoperands being compared. The addressing modes or address computation maybe separated from the load or the store operations. In an embodiment, aload operation with a base register and an offset may be split into twooperations: an add operation that computes the final address by addingthe constant offset value to a pseudo register, followed by the actualload operation that uses the pseudo register containing the computedfinal address. This may be done to keep the representation in a mostgeneric form as addressing modes of various forms can be used by theupdated application binary. The operation arguments that are constantsmay be represented by a number of bits that is needed to encode thevalid range of constants.

For example, a constant “Const8bits” may be used as an operand for anoperation that indicates that the operand is any valid value that can beencoded by 8 bits and, therefore, determine the valid dynamic range ofvalues allowed. Some operands may be hard-coded constants (e.g., “#8”indicating the value ‘8’). The operands of the direct branch operationmay be represented as an offset from the current program counter (e.g.,(“ProgCounter+#Const20bits”, or “ProgCounter+#12”)). A pseudo binarycode template 1202 may implement the functionality of interest usingthese or other operation statements. It should be appreciated that theoperation statements may be used to identify the region in the newupdated binary that implements the exact functionality via, for example,a matching functionality or module. The matching module is configured tounderstand both the format and the representation of the pseudo binarycode template 1202 and the actual binary of the application. Thematching module may perform an operation-by-operation comparison withina window of operations to detect matches, or use control-data-flow andthe operations within the control-data-flow region for comparison.

Various matching techniques may be used. The operation statements in thepseudo binary code template 1202 may use Static Single Assignment (SSA)representation, where a particular pseudo register variable is assignedonly once, thereby exposing the true dependencies among the operationstatements. The SSA representation may enable improved matching of thefunctionality region in the updated binary of the application. The term“pseudo” refer to the fact that the representation is not a binaryexecutable and does not use actual assembly instructions, registers, andaddressing mode of the processor and is not assembled into binary code.The pseudo binary code template 1202 provides the functionalityreference that the matching module uses as a template pattern andguideline to detect the functionality of interest in the updated binaryof the application. It should be appreciated that the actual format andrepresentation of the pseudo binary code template 1202 is implementationdependent and various other alternatives can be used. In otherembodiments, some implementations may use the actual assemblyinstruction representation or representation(s) that resemble theassembly representation for the CPU 102 on which the binary applicationruns.

As described above, the HLOS 106 may maintain a list of registeredapplications 112. For each registered application, the HLOS 106maintains tables (e.g., VAFMT 120, IVAMT 122) comprising virtualaddresses 302 for functional points of interest 304. As illustrated inFIG. 12, one or more virtual addresses 302 in the VAFMT 120 may beassociated with a pseudo binary code template 1202. In the embodiment ofFIG. 12, the pseudo binary code template 1202 is associated with a setof virtual addresses 302 for a particular set of functional points ofinterest 304 representing a unique functionality (documentWritefunction). The pseudo binary code template 1202 comprises pseudo codeinstruction(s) generically equivalent to the binary code covering thedocumentWrite function. In an embodiment, the pseudo binary codetemplate 1202 may not use the processor instruction set architecture(ISA) and need not be assembled into actual binary code. The pseudobinary code template 1202 may use operation statements similar toassembly operations and use pseudo registers and symbolic references forstorages. Through the use of a sequence of such operation statements,the pseudo binary code template 1202 may implement the functionality ofinterest that it represents (e.g., functionality of “documentWrite”function in the above example) that is the same as or equivalent to thefunctionality of interest (e.g., the documentWrite function) implementedin the actual binary of the application. It should be appreciated thatthe computing system 100 may include any number of pseudo binary codetemplates 1202. The number of different pseudo binary code templates1202 may be such that all the different functionalities captured in theVAFMT 120, through the different sets of functional points of interest,have at least one representative pseudo binary code template 1202 thatis used for updating the virtual addresses for the function points itcovers when a new application binary code is installed.

In an embodiment, the pseudo binary code template 1202 may comprise ageneric form of the target assembly instruction(s), one or more pseudoregisters, and memory access offsets from a generic base (e.g., globalheap or stack, a symbol/variable name) representing a specific referencepoints in memory. The metadata 1200 generally comprises avirtual-address free representation using, for example, a byte offset.The metadata 1200 for the virtual address (0x3473fac8) comprises a byteoffset (BASE2=BASE0+74709704). The metadata 1200 for the virtual address(0x3473fad4) comprises a byte offset (BASE2+12). The metadata 1200 forthe virtual address (0x3473fae8) comprises a byte offset (BASE2+32). Itshould be appreciated that this metadata may form a unique setcorresponding to the set of three virtual address points of interestthat uniquely represents the “document_write” functionality.

The pseudo binary code templates 1202 may be initially generated in anoff-line manner, provided to the computing system 100, and stored in thesecure storage of the device. It should be appreciated that the pseudobinary code templates 1202 may only need to be updated when there is anoticeable change in, for example, code and/or data structures in aregion covered by the functional points of interest 304. These types ofchanges may be relatively infrequent (e.g., once per 6 months). Updatesof this or other types may be implemented via an OTA update. This mayenable a significant reduction of OTA updates of the virtual addressesfrom, for example, a weekly/monthly basis to only doing the OTA updatesof the pseudo binary code templates 1202 once per 6 months.

An update or a re-install of a new binary version for an existingregistered application may be detected. In response, the metadata 1200and the pseudo binary code templates 1202 may be used to automaticallyupdate the VAFMT 120. As illustrated in FIG. 12, the pseudo binary codetemplates 1202 may be used to pattern match a region 1206 of the binarycode in the new application where the functional points of interest 304represented by pseudo binary code templates 1202 (and hence the virtualaddress points of interests that this particular pseudo binary codetemplate represents) are located. The metadata 1200 may be used to focusthe region 1206 to be searched in the updated version 1204 of theapplication binary code 108. Initial attempts may be made to search on afocused region 1206 (e.g., a predetermined percentage before and afterthe base, BASE2) by using a relative OFFSET from an original base(BASE0) for the functional points of interest 304 for a uniquefunctionality. It should be appreciated that in many types of frequentupdates these relative offsets remain close by. As further illustratedin FIG. 12, when a match is detected, the new virtual addresses may beobtained from the new binary, and the VAFMT 120 may be updated toreflect the new virtual addresses. If one or more functional points ofinterest 304 fail to yield a match in the new binary, the computingsystem 100 may initiate an OTA update or, in other embodiment, deletethe specific functionality of interest and the associated virtualaddresses from the VAFMT 120 based on the importance of the particularfunctionality.

FIG. 13 shows the VAFTM 120 from FIG. 12 with updated virtual addresses(represented by grey-out boxes). The virtual address 302 correspondingto the DOCUMENT_WRITE_FUNCTION_START point of interest 304 has beenupdated to a new virtual address (0x3133b61c). The virtual address 302corresponding to the DOCUMENT_WRITE_1 point of interest 304 has beenupdated to a new virtual address (0x3133b62c). The virtual address 302corresponding to the DOCUMENT_WRITE_2 point of interest 304 has beenupdated to a new virtual address (0x3133b62c). As further illustrated inFIG. 12, the metadata 1200 corresponding to the virtual addresses mayalso be updated. As illustrated in FIG. 13, metadata 1200 for the newvirtual address (0x3133b61c) has been updated to “BASE2=BASE0+74709000”.This illustrates that there has been a slight relative position changebetween the two functionalities of interest in the updated binary of theapplication (i.e., between the “KERNEL_ALLOCATOR_FUNCTION” and the“DOCUMENT_WRITE_FUNCTION”). The change may be relatively slight. Forexample, the change may be a reduction in 704 bytes out of the totaloriginal distance of 74709704 bytes between them. Therefore, with thesearch having been focused with some tolerance before and after the baseoffset metadata (i.e., 74709704 bytes) between the two functionalitiesof interest allows for effective matches by narrowing the search region.Metadata 1200 for the new virtual address (0x3133b62c) has been updatedto BASE2+16. Metadata 1200 for the new virtual address (0x3133b640) hasbeen updated to BASE2+36.

FIGS. 14 & 15 illustrate an exemplary embodiment of a pseudo binary codetemplate 1202 associated with a set of functional points of interest 304related to a DOCUMENT_WRITE_function. The set of functional points ofinterest 304 comprises a DOCUMENT_WRITE_FUNCTION_START module, aDOCUMENT_WRITE_1 module, and a DOCUMENT_WRITE_2 module. As illustratedin FIG. 14, each of the functional points of interest 304 in the set aredirectly associated with specific pseudo code instructions that form the“pseudo binary instruction points of interest” within the pseudo binarycode template 1202. These “psuedo binary instruction points of interest”within the pseudo binary code template 1202 comprise the one-to-onemapping of the virtual address points of interest in the current VAFMT120 with the new virtual address points of interest in the updatedversion of the application binary depending on the specific binaryinstructions in the updated application binary that directly matchedwith the “pseudo binary points of interest”. As illustrated in FIG. 14,the DOCUMENT_WRITE_FUNCTION_START module is associated with a “push”operation that saves the first two caller saved pseudo registers(CallSave0, CallSave1) and the Return register (ReturnReg). It isfollowed by an AddWord operation that computes the address required bythe subsequent LoadWord operation. The AddWord operation adds a constantvalue that should fit in 8 bits with the program counter and saves theresult in pseudo register reg0. The subsequent LoadWord operationdirectly uses the address in reg0 as the address to load the value from.In the actual binary for the application, the AddWord with the 8 bitconstant can be directly included in the LoadWord instruction as a partof the addressing mode. The ‘Const8bits’ allows the option to have anyconstant value that fits in 8-bits. The loaded value is kept in thepseudo register reg1 and is used as the address for the second LoadWordoperation that loads a value in pseudo register reg2. For the functionalpoint of interest denoted by DOCUMENT_WRITE_FUNCTION_START, the “push”operation is the “pseudo binary instruction point of interest” in thispseudo binary code template 1202.

The DOCUMENT_WRITE_1 module is associated with a logical-shift-leftoperation by 16-bits of a value that is kept in pseudo register (reg0)and saved in pseudo register reg1. It is then added with the constantvalue ‘4’ and saved in pseudo register reg2 that is then used as anaddress from which a value is loaded in pseudo register (reg3). It is tobe noted that for the actual binary load instruction, the addressingmode could directly perform the addition by the constant value 4, andhence the AddWord and the LoadWord could be represented by a single loadinstruction. The value in reg3 is further added to the program-countervalue (PC) to create the final address in pseudo register reg4 that isthe address from which a byte value is loaded into the first argumentregister ‘ArgumentReg0’ that is used to pass as the first argument to acalled routine. After that there is a direct branch to the address thatis at an offset which is a value that can fit in 20 bits. However,before the direct branch instruction there is an AddWord instructionthat saves the address to return to (by properly setting the ReturnReg)after the direct branch takes the control to a different part of theapplication. The “logical-shift-left” operation is the “pseudo binaryinstruction point of interest” in this pseudo binary code template 1202for the functional point of interest denoted by DOCUMENT_WRITE_1.

The DOCUMENT_WRITE_2 module is associated with an AddWord operation thatadds a constant value that can fit in 8bits with the program counter andkeeps the result in pseudo register reg0. The pseudo register reg0 isthen used as an address from which a value is loaded in pseudo register(reg2). It is followed by another AddWord operation that adds the pseudoregister (reg2) and the current value of the program counter and keepsthe result in pseudo register reg1. The pseudo register reg1 is thenused as an address from which a value is loaded in the ArgumentReg0 thatis used to pass a value to the subsequent subroutine call through adirect branch instruction. It is to be noted that for the actual binaryload instruction, the addressing mode could directly perform theaddition by the constant value, and hence the AddWord and the LoadWordcould be represented by a single load instruction in the actual binaryof the application. After the LoadWord operation, there is a directbranch to the address that is at an offset which is a value that can fitin 20 bits. However, before the direct branch instruction there is anAddWord instruction that saves the address to return (by properlysetting the ReturnReg) to after the direct branch takes the control to adifferent part of the application. The call to the subroutine isfollowed by two sets of comparisons and branching to nearby locationswithin the pseudo binary code template 1202. Both the comparisons aredone on the first Subroutine Return Value Register (ReturnValueReg0) tocheck for specific values (‘0’ and ‘1’) returned by the subroutine andbased on the returned value doing branches locally using BrnachEQ andBranchNE operations respectively. The branch target addresses areprovided as a Constant offset from the current program counter value.The AddWord operation that adds the Const8bits operand with the programcounter is the “pseudo binary instruction point of interest” in thispseudo binary code template 1202 for the functional point of interestdenoted by DOCUMENT_WRITE_2. It is to be noted that the actual binary ofthe application could have this address computation operation (AddWord)together with the LoadWord operation in the pseudo binary code templatematch to a single actual binary instruction (as “ldr r1, [pc,#80]), andin this case the actual binary instruction where the “pseudo binaryinstruction point of interest” matches either in full or as a subpartof, becomes the instruction that determines the updated virtual addressin the new version of the binary of the application.

FIG. 15 illustrates the matching of each of the pseudo code instructionsin the pseudo binary code template 1202 to equivalent correspondingbinary code in the matched region 1206 of the updated version 1204 ofthe application binary code 108. In operation, when the pseudo binarycode template 1202 matches the region 1206, the virtual addresses of thecorresponding instructions in the binary code that match the functionalpoints of interest 304 become the new virtual addresses and are updatedin the VAFMT 120. The new base and offsets may be computed based on thenew virtual addresses, and the metadata 1200 may be updated.

FIG. 16 illustrates an embodiment of a method 1600 implemented in thecomputing system 100 for automatically updating the VAFMT 120 when a newor updated version of the application binary code 108 is installed. Atblock 1602, a virtual address mapping table 120 for an applicationregistered with the HLOS 106 may be stored in the computing system 100,as described above. The VAFMT 120 may be stored in a secure memory inthe HLOS 106. As illustrated in FIG. 12, the VAFMT 120 may comprise aplurality of sets of virtual addresses 302 mapped to correspondingtarget application functionalities (functional points of interest 304)in the application binary code 108 for the registered application. Inresponse to receiving an updated version 1204 of the application binarycode 108 (decision block 1604), the corresponding pseudo binary codetemplates 1202 associated with one or more of the plurality of sets ofvirtual addresses 302 in the virtual address mapping table 120 may bedetermined (block 1606). As mentioned above, in an embodiment, thepseudo binary code templates 1202 may initially be acquired throughover-the-air (OTA) updates to the system 100 together with the initialVAFMT 120, or by any other means of downloading and installing code/dateon the system 100. Both these pseudo binary code templates 1202 and theVAFMT 120 may be stored in the system 100 in locations accessible by theHLOS 106 and the kernel. The actual storage location is implementationdependent. Various levels of security protection or secure memoryconfigurations can be considered for the storage locations and isdependent on the implementation choice. The pseudo binary code templates1202 may be updated when, for example, one or more of the existingtemplates are not able to find any matches in the updated binary of theapplication. Mismatches may happen due to large scale change in theapplication code in the regions of interests, or other kinds of changesdescribed above. During such situations, updated pseudo binary codetemplates 1202 and an updated VAFMT 120 may be OTA downloaded andinstalled in the system 100. At decision block 1608, the pseudo binarycode template 1202 is used to search the updated version 1204 of theapplication binary code 108 and match the pseudo code instruction(s) tothe equivalent binary instructions. When matches are found, at block1610, the new virtual addresses corresponding to the binary instructionsare determined. At block 1612, the virtual address mapping table 120 maybe updated with the new virtual addresses and corresponding updatedbase/offset metadata 1200.

As illustrated in FIG. 16, blocks 1606, 1608, 1610, and 1612 may beiterated for all the different pseudo binary code templates 1202 untilall the pseudo binary code templates 1202 are matched and all thevirtual addresses in the VAFMT 120 are updated. At decision block 1611,the method 1600 may determine if all pseudo binary code templates 1202have been processed. If “yes”, the method 1600 may end at block 1613. If“no”, a new pseudo binary code template 1202 may be selected at block1606. At decision block 1608, as matching binary sequences areidentified in the updated binary of the application for a particularpseudo binary code template 1202, the method 1600 may iterate to thenext pseudo binary code template 1202 for matching. If at some iterationthere is no match for a pseudo binary code template 1202 in the updatedbinary of the application, it is first determined if the functionalityof interest, represented by the pseudo binary code template 1202, can bedeleted from the VAFMT 120 (decision block 1607). If it can be deleted(which may be due to different reasons, including the importance of thefunctionality being low), all the virtual address point of interestentries for this functionality of interest may be deleted from the VAFMT120 (block 1605) and the iteration continues to block 1606 to search fora match for the next pseudo binary code template 1202. However, if thefunctionality (and hence the pseudo binary code template 1202) isimportant and should not be deleted (block 1609), an automatic updatemechanism fails, in which case a complete over-the-air (OTA) update forthe virtual addresses and/or the pseudo binary code templates 1202 maybe performed. This may represent the case where there is a drasticchange/modification in the updated binary of the application (e.g., thathappens with less frequency, once in a 6-month).

It should be appreciated that one or more of the method steps describedherein may be stored in the memory as computer program instructions,such as the modules described above. These instructions may be executedby any suitable processor in combination or in concert with thecorresponding module to perform the methods described herein.

Certain steps in the processes or process flows described in thisspecification naturally precede others for the invention to function asdescribed. However, the invention is not limited to the order of thesteps described if such order or sequence does not alter thefunctionality of the invention. That is, it is recognized that somesteps may performed before, after, or parallel (substantiallysimultaneously with) other steps without departing from the scope andspirit of the invention. In some instances, certain steps may be omittedor not performed without departing from the invention. Further, wordssuch as “thereafter”, “then”, “next”, etc. are not intended to limit theorder of the steps. These words are simply used to guide the readerthrough the description of the exemplary method.

Additionally, one of ordinary skill in programming is able to writecomputer code or identify appropriate hardware and/or circuits toimplement the disclosed invention without difficulty based on the flowcharts and associated description in this specification, for example.

Therefore, disclosure of a particular set of program code instructionsor detailed hardware devices is not considered necessary for an adequateunderstanding of how to make and use the invention. The inventivefunctionality of the claimed computer implemented processes is explainedin more detail in the above description and in conjunction with theFigures which may illustrate various process flows.

In one or more exemplary aspects, the functions described may beimplemented in hardware, software, firmware, or any combination thereof.If implemented in software, the functions may be stored on ortransmitted as one or more instructions or code on a computer-readablemedium. Computer-readable media include both computer storage media andcommunication media including any medium that facilitates transfer of acomputer program from one place to another. A storage media may be anyavailable media that may be accessed by a computer. By way of example,and not limitation, such computer-readable media may comprise RAM, ROM,EEPROM, NAND flash, NOR flash, M-RAM, P-RAM, R-RAM, CD-ROM or otheroptical disk storage, magnetic disk storage or other magnetic storagedevices, or any other medium that may be used to carry or store desiredprogram code in the form of instructions or data structures and that maybe accessed by a computer.

Also, any connection is properly termed a computer-readable medium. Forexample, if the software is transmitted from a website, server, or otherremote source using a coaxial cable, fiber optic cable, twisted pair,digital subscriber line (“DSL”), or wireless technologies such asinfrared, radio, and microwave, then the coaxial cable, fiber opticcable, twisted pair, DSL, or wireless technologies such as infrared,radio, and microwave are included in the definition of medium.

Disk and disc, as used herein, includes compact disc (“CD”), laser disc,optical disc, digital versatile disc (“DVD”), floppy disk and blu-raydisc where disks usually reproduce data magnetically, while discsreproduce data optically with lasers. Combinations of the above shouldalso be included within the scope of computer-readable media.

Alternative embodiments will become apparent to one of ordinary skill inthe art to which the invention pertains without departing from itsspirit and scope. Therefore, although selected aspects have beenillustrated and described in detail, it will be understood that varioussubstitutions and alterations may be made therein without departing fromthe spirit and scope of the present invention, as defined by thefollowing claims.

What is claimed is:
 1. A method for updating virtual memory addresses oftarget application functionalities for an updated version of applicationbinary code, the method comprising: storing a plurality of virtualaddress mapping tables, each virtual address mapping table associatedwith application binary code of a corresponding one of a plurality ofapplications registered with a high-level operating system, each virtualaddress mapping table comprising a plurality of virtual addresses of theapplication binary code mapped to corresponding target applicationfunctionalities in source code of the application; in response toreceiving an updated version of the application binary code, selecting apseudo binary code template associated with one or more of the pluralityof virtual addresses in the virtual address mapping table; matching thepseudo binary code template to binary instructions in the updatedversion of the application binary code; determining the new virtualaddresses corresponding to the matching binary instructions; andupdating the virtual address mapping table with the new virtualaddresses.
 2. The method of claim 1, wherein the matching the pseudobinary code template to the binary instructions in the updated versionof the application binary code comprises: searching a focused region ofthe updated version of the application binary code.
 3. The method ofclaim 2, wherein the focused region is defined by base/offset metadataassociated with the virtual addresses for the target applicationfunctionalities.
 4. The method of claim 3, wherein the base/offsetmetadata is stored in the virtual address mapping table.
 5. The methodof claim 1, wherein the virtual address mapping table comprisesbase/offset metadata associated with the one or more of the plurality ofvirtual addresses for the target application functionalities.
 6. Themethod of claim 5, wherein the base/offset metadata defines a focusedregion of the updated version of the application binary code forsearching for the matching binary instructions.
 7. The method of claim1, wherein the pseudo binary code template comprises pseudo codeinstructions equivalent to binary code instructions related to one ormore of the target application functionalities.
 8. A system for updatingvirtual memory addresses of target application functionalities for anupdated version of application binary code, the system comprising: meansfor storing a plurality of virtual address mapping tables, each virtualaddress mapping table associated with application binary code of acorresponding one of a plurality of applications registered with ahigh-level operating system, each virtual address mapping tablecomprising a plurality of virtual addresses of the application binarycode mapped to corresponding target application functionalities insource code of the application; means for selecting, in response toreceiving an updated version of the application binary code, a pseudobinary code template associated with one or more of the plurality ofvirtual addresses in the virtual address mapping table; means formatching the pseudo binary code template to binary instructions in theupdated version of the application binary code; means for determiningthe new virtual addresses corresponding to the matching binaryinstructions; and means for updating the virtual address mapping tablewith the new virtual addresses.
 9. The system of claim 8, wherein themeans for matching the pseudo binary code template to the binaryinstructions in the updated version of the application binary codecomprises: means for searching a focused region of the updated versionof the application binary code.
 10. The system of claim 9, wherein thefocused region is defined by base/offset metadata associated with thevirtual addresses for the target application functionalities.
 11. Thesystem of claim 10, wherein the base/offset metadata is stored in thevirtual address mapping table.
 12. The system of claim 8, wherein thevirtual address mapping table comprises base/offset metadata associatedwith virtual addresses with the one or more of the plurality of virtualaddresses for the target application functionalities.
 13. The system ofclaim 12, wherein the base/offset metadata defines a focused region ofthe updated version of the application binary code for searching for thematching binary instructions.
 14. The system of claim 8, wherein thepseudo binary code template comprises pseudo code instructionsequivalent to binary code instructions representing one or more of thetarget application functionalities.
 15. A computer program embodied in anon-transitory computer readable medium and executed by a processor forupdating virtual memory addresses of target application functionalitiesfor an updated version of application binary code, the computer programcomprising logic configured: store a plurality of virtual addressmapping tables, each virtual address mapping table associated withapplication binary code of a corresponding one of a plurality ofapplications registered with a high-level operating system, each virtualaddress mapping table comprising a plurality of virtual addresses of theapplication binary code mapped to corresponding target applicationfunctionalities in source code of the application; in response toreceiving an updated version of the application binary code, select apseudo binary code template associated with one or more of the pluralityof virtual addresses in the virtual address mapping table; match thepseudo binary code template to binary instructions in the updatedversion of the application binary code; determine the new virtualaddresses corresponding to the matching binary instructions; and updatethe virtual address mapping table with the new virtual addresses. 16.The computer program of claim 15, wherein the logic configured to matchthe pseudo binary code template to the binary instructions in theupdated version of the application binary code comprises: logicconfigured to search a focused region of the updated version of theapplication binary code.
 17. The computer program of claim 16, whereinthe focused region is defined by base/offset metadata associated withthe virtual addresses for the target application functionalities. 18.The computer program of claim 17, wherein the base/offset metadata isstored in the virtual address mapping table.
 19. The computer program ofclaim 15, wherein the virtual address mapping table comprisesbase/offset metadata associated with the one or more of the plurality ofvirtual addresses for the target application functionalities.
 20. Thecomputer program of claim 19, wherein the base/offset metadata defines afocused region of the updated version of the application binary code forsearching for the matching binary instructions.
 21. The computer programof claim 15, wherein the pseudo binary code template comprises pseudocode instructions equivalent to binary code instructions representingone or more of the target application functionalities.
 22. A system forupdating virtual memory addresses of target application functionalitiesfor an updated version of application binary code, the systemcomprising: a processing device configured to execute application binarycode; a high-level operating system (HLOS) comprising a plurality ofvirtual address mapping tables, each virtual address mapping tableassociated with application binary code of a corresponding one of aplurality of applications, each virtual address mapping table comprisinga plurality of virtual addresses of the application binary code mappedto corresponding target application functionalities in source code ofthe application; and a controller for updating the virtual addressmapping table in response to receiving an updated version of theapplication binary code, the controller comprising logic configured to:select a pseudo binary code template associated with one or more of theplurality of virtual addresses in the virtual address mapping table;match the pseudo binary code template to binary instructions in theupdated version of the application binary code; determine the newvirtual addresses corresponding to the matching binary instructions; andupdate the virtual address mapping table with the new virtual addresses.23. The system of claim 22, wherein the controller matches the pseudobinary code template to the binary instructions in the updated versionof the application binary code comprises by searching a focused regionof the updated version of the application binary code.
 24. The system ofclaim 23, wherein the focused region is defined by base/offset metadataassociated with the virtual addresses for the target applicationfunctionalities.
 25. The system of claim 24, wherein the base/offsetmetadata is stored in the virtual address mapping table.
 26. The systemof claim 1, wherein the virtual address mapping table comprisesbase/offset metadata associated with the one or more of the plurality ofvirtual addresses for the target application functionalities.
 27. Thesystem of claim 26, wherein the base/offset metadata defines a focusedregion of the updated version of the application binary code forsearching for the matching binary instructions.
 28. The system of claim22, wherein the pseudo binary code template comprises pseudo codeinstructions equivalent to binary code instructions representing one ormore of the target application functionalities.
 29. The system of claim22, wherein the HLOS is configured to detect the target applicationfunctionalities, during execution of the updated version of theapplication binary code, when one or more of the new virtual addressescorresponding to the target application functionalities are executed.30. The system of claim 22, wherein the application binary codecomprises one of a secure web application and a web browser.